<?php

echo $pagination;

?>



	<div class="modal fade bs-example-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">

				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">Просмотр изображения</h4>
				</div>


				<div class="modal-body">

				</div>


				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
				</div>
			</div>
		</div>
	</div>



<div class="row">
	<?php
	$i = 0;
	foreach ($data as $value) {
		++$i;
		?>

		<div class="col-md-4 text-center">
			<a class="example-image-link" href="/<?php echo Kohana::$config->load('names.picture.path') . $value->file;?>" data-lightbox="example-set" title="<?php echo htmlspecialchars($value->text);?>">
			<?php
		echo HTML::image(
			'/assets/plugins/ajax-loader.gif',
			#Kohana::$config->load('names.picture.small.path') . $value->file,
			array(
			'class' => 'img-rounded',
			#'data-toggle'=>'modal',
			#'data-target' => '#myModal',
			'image-id' => $value->id,
			'id' => 'image-' . $value->id,
			));

		?>
			</a>
		</div>
	<?php
		if (($i % 3) == 0) {
			?>

</div>


<div class="row">

<?php
		}
	}


	?>
</div>

<?php

echo $pagination;
?>


<script type="text/javascript">
	$(document).ready(function() {
		$('.img-rounded').click(function() {
			$('.modal-body').html('<?php echo HTML::image('/assets/plugins/ajax-loader.gif');?>');
			var image_id = $(this).attr('image-id');
			$.ajax({
				type: "POST",
				url: "/ajax",
				data: { image_id: image_id}
			})
				.done(function( msg ) {
					$('.modal-body').html(msg);
				});
		});
	});
</script>

